function applyMixins(derivedCtor, baseCtors) {
    // 遍历基础属性
    baseCtors.forEach(function (baseCtor) {
        // 进行赋值操作
        Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) {
            derivedCtor.prototype[name] = baseCtor.prototype[name];
        });
    });
}
var Disposable = /** @class */ (function () {
    function Disposable() {
    }
    Disposable.prototype.dispose = function () {
        this.isDisposed = true;
    };
    return Disposable;
}());
var Activatable = /** @class */ (function () {
    function Activatable() {
    }
    Activatable.prototype.activate = function () {
        this.isActive = true;
    };
    Activatable.prototype.deactivate = function () {
        this.isActive = false;
    };
    return Activatable;
}());
// 没使用extends而是使用implements。 把类当成了接口，
// 仅使用Disposable和Activatable的类型而非其实现。
var SmartObject = /** @class */ (function () {
    function SmartObject() {
        var _this = this;
        // Disposable 的占位属性 将来会通过 mixin 把真正的函数和方法 赋值 给这两个占位属性
        this.isDisposed = false;
        // Activatable 
        this.isActive = false;
        setInterval(function () { return console.log(_this.isActive + ":" + _this.isDisposed); }, 500);
    }
    SmartObject.prototype.interact = function () {
        this.activate();
    };
    return SmartObject;
}());
applyMixins(SmartObject, [Disposable, Activatable]);
var smartObj = new SmartObject();
setTimeout(function () { return smartObj.interact(); }, 1000);
